home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / sh-utils.12 / sh-utils / sh-utils-1.12 / src / Makefile.in < prev    next >
Encoding:
Makefile  |  1994-11-04  |  6.8 KB  |  265 lines

  1. # Makefile for GNU shell utilities.
  2. # Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
  3.  
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2, or (at your option)
  7. # any later version.
  8.  
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. # GNU General Public License for more details.
  13.  
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program; if not, write to the Free Software
  16. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18. SHELL = /bin/sh
  19.  
  20. srcdir = @srcdir@
  21. VPATH = @srcdir@
  22.  
  23. prefix = @prefix@
  24. exec_prefix = @exec_prefix@
  25. bindir = $(exec_prefix)/bin
  26. libdir = $(exec_prefix)/lib
  27.  
  28. INSTALL = @INSTALL@
  29. INSTALL_PROGRAM = @INSTALL_PROGRAM@
  30. CC = @CC@
  31. DEFS = @DEFS@
  32. LIBS = @LIBS@
  33. CFLAGS = @CFLAGS@
  34. LDFLAGS = @LDFLAGS@
  35. RM = rm
  36.  
  37. SOURCES = basename.c date.c dirname.c echo.c env.c expr.c hostname.c id.c \
  38. logname.c pathchk.c printenv.c printf.c pwd.c sleep.c su.c \
  39. tee.c test.c tty.c who.c whoami.c yes.c nice.c stty.c uname.c version.c
  40.  
  41. OBJECTS = basename.o date.o dirname.o echo.o env.o expr.o hostname.o id.o \
  42. logname.o pathchk.o printenv.o printf.o pwd.o sleep.o su.o \
  43. tee.o test.o tty.o users.o who.o whoami.o yes.o nice.o stty.o uname.o \
  44. version.o
  45.  
  46. DISTFILES = Makefile.in system.h $(SOURCES) groups.sh nohup.sh \
  47. false.sh true.sh version.h
  48.  
  49. PROGS = basename date dirname echo env expr false groups hostname id logname \
  50. pathchk printenv printf pwd sleep tee test true tty users who whoami yes @PROGS@
  51.  
  52. LIBPROGS =
  53.  
  54. all: $(PROGS) su $(LIBPROGS)
  55.  
  56. .SUFFIXES:
  57. .SUFFIXES: .c .o
  58.  
  59. incl = -I.. -I$(srcdir) -I../lib -I$(srcdir)/../lib
  60. .c.o:
  61.     $(CC) -c $(CPPFLAGS) $(DEFS) $(incl) $(CFLAGS) $<
  62.  
  63. subdir = src
  64. Makefile: ../config.status Makefile.in
  65.     cd .. && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status
  66.  
  67. installdirs:
  68.     $(srcdir)/../mkinstalldirs $(bindir)
  69.  
  70. transform = @program_transform_name@
  71. install: all installdirs
  72.     for f in $(PROGS); do \
  73.       $(INSTALL_PROGRAM) $$f \
  74.           $(bindir)/`echo $$f|sed '$(transform)'`; \
  75.     done
  76.     $(RM) -f $(bindir)/'['; ln $(bindir)/$(binprefix)test $(bindir)/'['
  77.     @if test `./id -u` = 0; then \
  78.     echo you are root, so installing su; \
  79.     $(INSTALL_PROGRAM) su $(bindir)/$(binprefix)su; \
  80.     chown root $(bindir)/$(binprefix)su; \
  81.     chmod 4755 $(bindir)/$(binprefix)su; \
  82.     else echo WARNING: you are not root, so not installing su; fi
  83.  
  84. uninstall:
  85.     $(RM) -f $(bindir)/'['
  86.     for f in $(PROGS) su; do \
  87.       $(RM) -f \
  88.           $(bindir)/`echo $$f|sed '$(transform)'`; \
  89.     done
  90.  
  91. TAGS: $(SOURCES)
  92.     etags $(SOURCES)
  93.  
  94. check:
  95.  
  96. clean:
  97.     $(RM) -f $(PROGS) su $(LIBPROGS) *.o core '[' .version users.c
  98.  
  99. mostlyclean: clean
  100.  
  101. distclean: clean
  102.     $(RM) -f Makefile
  103.  
  104. realclean: distclean
  105.     $(RM) -f TAGS
  106.  
  107. distdir = ../`cat ../distname`/$(subdir)
  108. dist: $(DISTFILES)
  109.     for file in $(DISTFILES); do \
  110.       ln $$file $(distdir) \
  111.         || { echo copying $$file instead; cp -p $$file $(distdir);}; \
  112.     done
  113.  
  114. # Linking rules.
  115.  
  116. link_command = $(CC) $(LDFLAGS) -o $@
  117.  
  118. .version: version.c
  119.     sed -e '/version_string/!d' \
  120.         -e 's/[^"]*"\([^"]*\)".*/\1/' \
  121.         -e q $(srcdir)/version.c \
  122.       > $@-t
  123.     mv $@-t $@
  124.  
  125. basename: basename.o
  126.     $(link_command) basename.o ../lib/libshu.a version.o $(LIBS)
  127.  
  128. date: date.o
  129.     $(link_command) date.o ../lib/libshu.a version.o $(LIBS)
  130.  
  131. dirname: dirname.o
  132.     $(link_command) dirname.o ../lib/libshu.a version.o $(LIBS)
  133.  
  134. echo: echo.o
  135.     $(link_command) echo.o ../lib/libshu.a version.o $(LIBS)
  136.  
  137. env: env.o
  138.     $(link_command) env.o ../lib/libshu.a version.o $(LIBS)
  139.  
  140. expr: expr.o
  141.     $(link_command) expr.o ../lib/libshu.a version.o $(LIBS)
  142.  
  143. false: false.sh .version
  144.     $(RM) -f $@ $@-t
  145.     sed -e "s/@VERSION@/`cat .version`/" $(srcdir)/false.sh \
  146.         > $@-t
  147.     mv $@-t $@
  148.     chmod +x $@
  149.  
  150. groups: groups.sh .version
  151.     $(RM) -f $@ $@-t
  152.     sed -e "s,@bindir@,$(bindir),g" \
  153.         -e "s/@VERSION@/`cat .version`/" $(srcdir)/groups.sh \
  154.         > $@-t
  155.     mv $@-t $@
  156.     chmod +x $@
  157.  
  158. hostname: hostname.o 
  159.     $(link_command) hostname.o ../lib/libshu.a version.o $(LIBS)
  160.  
  161. id: id.o
  162.     $(link_command) id.o ../lib/libshu.a version.o $(LIBS)
  163.  
  164. logname: logname.o
  165.     $(link_command) logname.o ../lib/libshu.a version.o $(LIBS)
  166.  
  167. nohup: nohup.sh .version
  168.     $(RM) -f $@ $@-t
  169.     sed -e "s,@bindir@,$(bindir),g" \
  170.         -e "s/@VERSION@/`cat .version`/" $(srcdir)/nohup.sh \
  171.         > $@-t
  172.     mv $@-t $@
  173.     chmod +x $@
  174.  
  175. pathchk: pathchk.o
  176.     $(link_command) pathchk.o ../lib/libshu.a version.o $(LIBS)
  177.  
  178. printenv: printenv.o
  179.     $(link_command) printenv.o ../lib/libshu.a version.o $(LIBS)
  180.  
  181. # Link with -lm in case strtod.o needs to get `pow'.
  182. printf: printf.o
  183.     $(link_command) printf.o ../lib/libshu.a version.o $(LIBS) -lm
  184.  
  185. pwd: pwd.o 
  186.     $(link_command) pwd.o ../lib/libshu.a version.o $(LIBS)
  187.  
  188. sleep: sleep.o
  189.     $(link_command) sleep.o ../lib/libshu.a version.o $(LIBS)
  190.  
  191. su: su.o
  192.     $(link_command) su.o ../lib/libshu.a version.o $(LIBS)
  193.  
  194. tee: tee.o
  195.     $(link_command) tee.o ../lib/libshu.a version.o $(LIBS)
  196.  
  197. test: test.o
  198.     $(link_command) test.o ../lib/libshu.a version.o $(LIBS)
  199.  
  200. true: true.sh .version
  201.     $(RM) -f $@ $@-t
  202.     sed -e "s/@VERSION@/`cat .version`/" $(srcdir)/true.sh \
  203.         > $@-t
  204.     mv $@-t $@
  205.     chmod +x $@
  206.  
  207. tty: tty.o
  208.     $(link_command) tty.o ../lib/libshu.a version.o $(LIBS)
  209.  
  210. users: users.o
  211.     $(link_command) users.o ../lib/libshu.a version.o $(LIBS)
  212.  
  213. who: who.o
  214.     $(link_command) who.o ../lib/libshu.a version.o $(LIBS)
  215.  
  216. whoami: whoami.o
  217.     $(link_command) whoami.o ../lib/libshu.a version.o $(LIBS)
  218.  
  219. yes: yes.o
  220.     $(link_command) yes.o ../lib/libshu.a version.o $(LIBS)
  221.  
  222. nice: nice.o
  223.     $(link_command) nice.o ../lib/libshu.a version.o $(LIBS)
  224.  
  225. stty: stty.o
  226.     $(link_command) stty.o ../lib/libshu.a version.o $(LIBS)
  227.  
  228. uname: uname.o
  229.     $(link_command) uname.o ../lib/libshu.a version.o $(LIBS)
  230.  
  231. # Special rules for some .o files.
  232.  
  233. su.o: su.c
  234.     $(CC) -c $(CPPFLAGS) -DSYSLOG_FAILURE -DSYSLOG_SUCCESS $(DEFS) \
  235.         $(incl) $(CFLAGS) $(srcdir)/su.c
  236.  
  237. test.o: test.c
  238.     $(CC) -c $(CPPFLAGS) -DTEST_STANDALONE $(DEFS) \
  239.         $(incl) $(CFLAGS) $(srcdir)/test.c
  240.  
  241. users.o: users.c
  242.     $(CC) -c $(CPPFLAGS) -DUSERS $(DEFS) $(incl) $(CFLAGS) $<
  243. users.c: who.c
  244.     $(RM) -f users.c
  245.     ln $(srcdir)/who.c users.c >/dev/null 2>&1 \
  246.         || cp $(srcdir)/who.c users.c
  247.  
  248. who.o: who.c
  249.     $(CC) -c $(CPPFLAGS) -DWHO $(DEFS) $(incl) $(CFLAGS) $<
  250.  
  251. $(PROGS) su $(LIBPROGS): ../lib/libshu.a version.o
  252. env.o id.o nice.o pathchk.o stty.o su.o tty.o uname.o users.o who.o: \
  253.   ../lib/getopt.h
  254. expr.o: ../lib/regex.h
  255. basename.o dirname.o echo.o expr.o hostname.o nice.o printf.o pwd.o \
  256.   stty.o test.o yes.o: ../lib/long-options.h
  257.  
  258. # Make all .o files depend on these files even though there are a few
  259. # unnecessary dependencies.
  260. $(OBJECTS): ../config.h system.h version.h
  261.  
  262. # Tell versions [3.59,3.63) of GNU make not to export all variables.
  263. # Otherwise a system limit (for SysV at least) may be exceeded.
  264. .NOEXPORT:
  265.